package com.cmdi.mq.feign;

import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;

/**
 * @Description: Feign容错处理类
 * @Author: gaozb
 */
@Configuration
@Slf4j
public class RemoteGatewayServiceFeignClientFallBackFactory implements FallbackFactory<RemoteGatewayServiceFeignClient> {
    @Override
    public RemoteGatewayServiceFeignClient create(Throwable throwable) {
        return new RemoteGatewayServiceFeignClient() {

            @Override
            public ResponseEntity<Boolean> updateRoute(String gwKey) {
                return new ResponseEntity<Boolean>(false, HttpStatus.NOT_ACCEPTABLE);
            }
        };
    }
}